/*
 * Copyright (c) 2020, China Mobile Communications Group Co.,Ltd.
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2020-11-18     cmcc       the first version
 */
#ifndef NINESKY_FACE_RECOGNITION_NS_FACE_RECOG_H_
#define NINESKY_FACE_RECOGNITION_NS_FACE_RECOG_H_

//base url
#define URL_FACE_DETECT_RECOG "http://aiaas.cmri.cn:8080/ivr/v1/face_detection?"
#define URL_FACE_LOCATION_RECOG "http://aiaas.cmri.cn:8080/ivr/v1/face_location?"
#define URL_FACE_PROPERTY_RECOG "http://aiaas.cmri.cn:8080/ivr/v1/face_attribute_recognition?"
#define URL_HUMAN_PROPERTY_RECOG "http://aiaas.cmri.cn:8080/ivr/v1/human_attribute_recognition?"

//face recognition result structure
typedef struct
{
    int faceNumber;
    char **faceRect;
} NS_Face_Detection;

typedef struct
{
    int faceNumber;

    /**
     * face array, the element of this array is point array of every face
     */
    char ***faceLocation;

    /**
     * the point count of every face
     */
    int *facePointCount;
} NS_Face_Location;

typedef struct
{
    int age;
    char *expression;
    char *gender;
    char *race;
} NS_Face_Property_Item;

typedef struct
{
    int faceNumber;
    NS_Face_Property_Item *items;
} NS_Face_Property;

typedef struct
{
    char *age;
    char *backpack;
    char *bag;
    char *boots;

    char *downColor;
    char *downShort;
    char *downType;
    char *facing;

    char *glasses;
    char *handbag;
    char *hat;
    char *holdObjectFront;

    char *isFemale;
    char *longHair;
    char *lowClothPants;
    char *shoesLight;

    char *topLong;
    char *upColor;
    char *upShort;
    char *upType;
} NS_Human_Property_Item;

typedef struct
{
    int personNumber;
    NS_Human_Property_Item *items;
} NS_Human_Property;

/**
 * Face detection.
 */
int ns_face_detection(char *token, char *contentBuffer, long contentSize, NS_Face_Detection *result);
int ns_face_detection_file(char *token, char *filePath, NS_Face_Detection *result);

/**
 * Face location.
 */
int ns_face_location(char *token, char *contentBuffer, long contentSize, NS_Face_Location *result);
int ns_face_location_file(char *token, char *filePath, NS_Face_Location *result);

/**
 * Face property.
 */
int ns_face_property(char *token, char *contentBuffer, long contentSize, NS_Face_Property *result);
int ns_face_property_file(char *token, char *filePath, NS_Face_Property *result);

/**
 * Human property.
 */
int ns_human_property(char *token, char *contentBuffer, long contentSize, NS_Human_Property *result);
int ns_human_property_file(char *token, char *filePath, NS_Human_Property *result);

#endif /* NINESKY_FACE_RECOGNITION_NS_FACE_RECOG_H_ */
